// 引入mockjs
const Mock = require('mockjs')
// 获取 mock.Random 对象
// 参考：https://github.com/nuysoft/Mock/wiki/Mock.Random
const Random = Mock.Random
let Result = {
	code: 200,
	msg: '操作成功',
	data: null
}

Mock.mock('/captcha', 'get', () => {
	Result.data = {
		token: Random.string(32), // 获取一个32位的随机字符串,
		captchaImg: Random.dataImage("120x40", "11111") //生成验证码为11111的base64图片编码
	}
	return Result
})

Mock.mock('/login', 'post', () => {
	// Result.code=400
	// Result.msg="验证码错误"
	return Result
})

Mock.mock('/adminInfo', 'get', () => {
	Result.data = {
		id: '1',
		name: 'admin',
		avatar: 'http://www.pigpeiqi666.com/avator.jpg'
	}
	return Result
})

Mock.mock('/logOut', 'get', () => {

	return Result
})

Mock.mock('/system/nav', 'get', () =>{

	let navs = [{
		title: "系统管理",
		name: "SysManage",
		icon: "el-icon-setting",
		path: "",
		component:"",
		children: [{
				title: "管理员管理",
				icon: "",
				path: "admin",
				component:"/wwt/Admin",
				name: "AdminManage",
				
			},
			{
				title: "权限管理",
				icon: "",
				path: "authority",
				component:"/wwt/Authority",
				name: "AuthManage"
			}
		]
	},
	{
		title: "商品管理",
		name: "GoodsManage",
		icon: "el-icon-shopping-cart-full",
		path: "",
		component:"",
		children: [{
				title: "商品管理",
				icon: "",
				path: "goods",
				component:"/xwk/Goods",
				name: "GoodsManage",
				
			},
			{
				title: "分类管理",
				icon: "",
				path: "params",
				component:"/xwk/Params",
				name: "CateManage"
			}
		]
	},{
		title: "订单管理",
		name: "OrderManage",
		icon: "el-icon-bell",
		path: "",
		component:"",
		children: [{
				title: "订单管理",
				icon: "",
				path: "order",
				component:"/ys/Order",
				name: "OrderManage",
				
			},
		]
	},
	{
		title: "用户管理",
		name: "UserManage",
		icon: "el-icon-user",
		path: "",
		component:"",
		children: [{
				title: "用户管理",
				icon: "",
				path: "user",
				component:"/zc/User",
				name: "UserManage",
				
			},
		]
	},
	]
	//权限
	let authorities = []
	Result.data = {
		navs: navs,
		authorities: authorities
	}
	
	return Result

})
